﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UpLoad.aspx.cs" Inherits="WinnerCMS.WebUI.Admin.Window.UpLoad" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>上传文件</title>
    <%: Scripts.Render("~/Scripts/AdminBase") %>
    <script src="../../Scripts/Uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
    
    <%: Styles.Render("~/Content/Bootstrap/css") %>
    <link href="../../Scripts/Uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        $(function ()
        {
            $("#uploadfile").uploadify({
                height: 30, 
                'multi': true,
                swf: '/Scripts/Uploadify/uploadify.swf',
                uploader: '../DataHandler.ashx?Action=FilesUpload',
                width: 120,
                cancelImg: '/Scripts/Uploadify/uploadify-cancel.png',
                buttonText: '上传文件',
                fileTypeExts: '*.zip;*.rar;*.dwg;*.doc;*.chm;*.pdf;*.gif;*.jpg;*.png;*.swf',
                fileSizeLimit: '6000KB',
                removeCompleted: true,
                'debug': false,
                formData: {
                     dir:Request.QueryString("dir")
                },
                onUploadSuccess: function (file, data, response)
                {
                    if (data.indexOf('错误提示') > -1)
                    {
                        alert(data);
                    }
                    else
                    {
                        var info = $.parseJSON(data);
                        $("#T_AnnexList tbody").append("<tr><td>" + info.FileName + "</td><td>" + info.DownURL + "</td><td style=\"text-align:center\"><a href=\"javascript:void(0)\" onclick=\"deleteAnnex(this," + info.Id + ");\">删除</a></td></tr>");
                    }
                },
                onUploadError: function (file, errorCode, errorMsg, errorString)
                {
                    alert('文件：' + file.name + ' 上传失败: ' + errorString);
                }
            });
        });
    </script>
    <style>
        #uploadfile {
            margin-left: auto;
            margin-right: auto;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
     <input type="file" name="uploadfile" id="uploadfile" />
    </form>
</body>
</html>
